package com.gec.system.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gec.model.entity.SysLetter;
import com.gec.model.entity.SysRepair;
import com.gec.model.vo.SysLetterVo;
import com.gec.system.mapper.SysLetterMapper;
import com.gec.system.service.SysLetterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 信件表 服务实现类
 * </p>
 *
 * @author lmd
 * @since 2023-12-08
 */
@Service
public class SysLetterServiceImpl extends ServiceImpl<SysLetterMapper, SysLetter> implements SysLetterService {

    @Autowired
    private SysLetterMapper sysLetterMapper;

    @Override
    public IPage<SysLetter> selectPage(IPage<SysLetter> iPage, SysLetterVo sysLetterVo) {

        return this.sysLetterMapper.selectPage(iPage,sysLetterVo);
    }

    @Override
    public void updateLetterOrigin(Long id, Integer origin) {
        //1.查询出当前信件
        SysLetter sysLetter = this.baseMapper.selectById(id);
        //2.设置状态
        sysLetter.setOrigin(origin);
        //3.更新
        this.baseMapper.updateById(sysLetter);
    }
}
